﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MoneyTrackin
{
    public partial class EditForm : Form
    {
        public EditForm()
        {
            InitializeComponent();
            this.dataSet1 = Logic.Instance.DataSet;
        }

        public BindingSource BindingSource
        {
            get { return transactionsBindingSource; }
        }

        private void menuItemCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        protected override void OnActivated(EventArgs e)
        {
            base.OnActivated(e);
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            Logic.Instance.AddTransaction(
                textBoxDescription.Text,
                Convert.ToDecimal(textBoxAmount.Text),
                dateTimePicker1.Value,
                textBoxTags.Text);
            textBoxDescription.Text = string.Empty;
            textBoxAmount.Text = string.Empty;
            dateTimePicker1.Value = DateTime.Now;
            textBoxTags.Text = string.Empty;
            this.Close();
        }
    }
}